Skip to contentSkip to conversation

Change in openvpn[master]: Use mingw compile definition also to unit tests

Openvpn-devel In review plaisthos (Code Review) 2 participants 9 messages Dec 7, 2023 – Jan 16, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1701971374000.Ie5aa643ab6190262f7c8b9e614bedb398e85859b@...2715...

#1 lore raw

Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/469?usp=email

to review the following change.

Change subject: Use mingw compile definition also to unit tests
......................................................................

Use mingw compile definition also to unit tests

Currently we only apply the defines for windows APIs and Unicode to OpenVPN itself. We should rather treat the unit tests the same as our main binary to reduce potential differences.

Change-Id Ie5aa643ab6190262f7c8b9e614bedb398e85859b

---
M CMakeLists.txt

1 file changed, 14 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/469/1

CMakeLists.txt +14 -8
index 577bc5d..8c24cca 100644
@@ -259,6 +259,15 @@
 
     endif ()
 
+    if (MINGW)
+        target_compile_options(${target} PRIVATE
+                -DWIN32_LEAN_AND_MEAN
+                -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA
+        )
+        target_compile_options(${target} PRIVATE -municode -UUNICODE)
+        target_link_options(${target} PRIVATE -municode)
+    endif()
+
     # optional dependencies
     target_link_libraries(${target} PUBLIC
         $<TARGET_NAME_IF_EXISTS:PkgConfig::liblz4>
@@ -514,14 +523,6 @@
 
 add_library_deps(openvpn)
 
-if (MINGW)
-    target_compile_options(openvpn PRIVATE
-        -DWIN32_LEAN_AND_MEAN
-        -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA
-        )
-    target_compile_options(openvpn PRIVATE -municode -UUNICODE)
-    target_link_options(openvpn PRIVATE -municode)
-endif()
 
 if (MSVC)
     # we have our own manifest
@@ -634,6 +635,11 @@
 
         target_include_directories(${test_name} PRIVATE src/openvpn)
 
+        if (MINGW)
+            # when compiling with -municode, mingw looks for wmain instead of main
+            target_compile_definitions(${test_name} PRIVATE -Dmain=wmain)
+        endif ()
+
         if (NOT ${test_name} STREQUAL "test_buffer")
             target_sources(${test_name} PRIVATE
                 src/openvpn/buffer.c

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie5aa643ab6190262f7c8b9e614bedb398e85859b
Gerrit-Change-Number: 469
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/469?usp=email )

Change subject: Use mingw compile definition also to unit tests
......................................................................

Patch Set 3: Code-Review-1

(2 comments)

File CMakeLists.txt:

http://gerrit.openvpn.net/c/openvpn/+/469/comment/b9f47f2d_bf7caf2c :
PS3, Line 293: target_compile_options(${target} PRIVATE -municode -UUNICODE)
combining -municode with -UUNICODE and main(void) just means the -municode has no effect at all. So I would drop that.

http://gerrit.openvpn.net/c/openvpn/+/469/comment/38857a3b_fc89aeff :
PS3, Line 666: target_compile_definitions(${test_name} PRIVATE -Dmain=wmain)
Yeah, just don't use -municode in the first place.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie5aa643ab6190262f7c8b9e614bedb398e85859b
Gerrit-Change-Number: 469
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 20 Dec 2023 12:25:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/469?usp=email )

Change subject: Use mingw compile definition also to unit tests
......................................................................

Patch Set 3:

(2 comments)

File CMakeLists.txt:

http://gerrit.openvpn.net/c/openvpn/+/469/comment/b683acf6_b1411977 :
PS3, Line 293: target_compile_options(${target} PRIVATE -municode -UUNICODE)

Quoted 1 line

combining -municode with -UUNICODE and main(void) just means the -municode has no effect at all. […]

I updated the patch to only use the same defines but not the -municode. After looking up -U that it undefines UNICODE I am not really sure anymore why we use that for the normal mingw build.

http://gerrit.openvpn.net/c/openvpn/+/469/comment/5b8769bf_b8607c4b :
PS3, Line 666: target_compile_definitions(${test_name} PRIVATE -Dmain=wmain)

Quoted 1 line

Yeah, just don't use -municode in the first place.

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie5aa643ab6190262f7c8b9e614bedb398e85859b
Gerrit-Change-Number: 469
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 03 Jan 2024 14:40:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/469?usp=email

to look at the new patch set (#4).

The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld

Change subject: Use mingw compile definition also to unit tests
......................................................................

Use mingw compile definition also to unit tests

Currently we only apply the defines for windows APIs and Unicode to OpenVPN itself. We should rather treat the unit tests the same as our main binary to reduce potential differences.

Change-Id Ie5aa643ab6190262f7c8b9e614bedb398e85859b

---
M CMakeLists.txt

1 file changed, 8 insertions(+), 5 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/469/4

CMakeLists.txt +8 -5
index bc46c27..6f370c3 100644
@@ -290,6 +290,13 @@
 
     endif ()
 
+    if (MINGW)
+        target_compile_definitions(${target} PRIVATE
+                -DWIN32_LEAN_AND_MEAN
+                -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA
+        )
+    endif()
+
     # optional dependencies
     target_link_libraries(${target} PUBLIC
         $<TARGET_NAME_IF_EXISTS:PkgConfig::liblz4>
@@ -545,11 +552,7 @@
 
 add_library_deps(openvpn)
 
-if (MINGW)
-    target_compile_options(openvpn PRIVATE
-        -DWIN32_LEAN_AND_MEAN
-        -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA
-        )
+if(MINGW)
     target_compile_options(openvpn PRIVATE -municode -UUNICODE)
     target_link_options(openvpn PRIVATE -municode)
 endif()

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie5aa643ab6190262f7c8b9e614bedb398e85859b
Gerrit-Change-Number: 469
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/469?usp=email )

Change subject: Use mingw compile definition also to unit tests
......................................................................

Patch Set 4: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie5aa643ab6190262f7c8b9e614bedb398e85859b
Gerrit-Change-Number: 469
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 08 Jan 2024 16:14:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#6 lore raw

PATCH v4 1/1 Use mingw compile definition also to unit tests

In reply to a message not in the archive

From: Arne Schwabe <[email protected]...>

Currently we only apply the defines for windows APIs and Unicode to OpenVPN itself. We should rather treat the unit tests the same as our main binary to reduce potential differences.

Change-Id Ie5aa643ab6190262f7c8b9e614bedb398e85859b

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/469
This mail reflects revision 4 of this Change. Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>

CMakeLists.txt +8 -5
index bc46c27..6f370c3 100644
@@ -290,6 +290,13 @@
 
     endif ()
 
+    if (MINGW)
+        target_compile_definitions(${target} PRIVATE
+                -DWIN32_LEAN_AND_MEAN
+                -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA
+        )
+    endif()
+
     # optional dependencies
     target_link_libraries(${target} PUBLIC
         $<TARGET_NAME_IF_EXISTS:PkgConfig::liblz4>
@@ -545,11 +552,7 @@
 
 add_library_deps(openvpn)
 
-if (MINGW)
-    target_compile_options(openvpn PRIVATE
-        -DWIN32_LEAN_AND_MEAN
-        -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA
-        )
+if(MINGW)
     target_compile_options(openvpn PRIVATE -municode -UUNICODE)
     target_link_options(openvpn PRIVATE -municode)
 endif()
#7 lore raw

[Openvpn-devel] [PATCH applied] Re: Use mingw compile definition also to unit tests

Your patch has been applied to the master branch.

(At some point we will want to collect all buildsystem-related improvements again and backport/cheery-pick to release/2.6)

commit 0ce06893912830fa2044c5d6a62e6333366afd4a (master)

Author: Arne Schwabe
Date:   Tue Jan 16 14:18:31 2024 +0100
     Use mingw compile definition also to unit tests

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Frank Lichtenheld <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg28019.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#8 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#5) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/469?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld

Change subject: Use mingw compile definition also to unit tests
......................................................................

Use mingw compile definition also to unit tests

Currently we only apply the defines for windows APIs and Unicode to OpenVPN itself. We should rather treat the unit tests the same as our main binary to reduce potential differences.

Change-Id Ie5aa643ab6190262f7c8b9e614bedb398e85859b

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28019.html

---
M CMakeLists.txt

1 file changed, 8 insertions(+), 5 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/469/5

CMakeLists.txt +8 -5
index bc46c27..6f370c3 100644
@@ -290,6 +290,13 @@
 
     endif ()
 
+    if (MINGW)
+        target_compile_definitions(${target} PRIVATE
+                -DWIN32_LEAN_AND_MEAN
+                -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA
+        )
+    endif()
+
     # optional dependencies
     target_link_libraries(${target} PUBLIC
         $<TARGET_NAME_IF_EXISTS:PkgConfig::liblz4>
@@ -545,11 +552,7 @@
 
 add_library_deps(openvpn)
 
-if (MINGW)
-    target_compile_options(openvpn PRIVATE
-        -DWIN32_LEAN_AND_MEAN
-        -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA
-        )
+if(MINGW)
     target_compile_options(openvpn PRIVATE -municode -UUNICODE)
     target_link_options(openvpn PRIVATE -municode)
 endif()

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie5aa643ab6190262f7c8b9e614bedb398e85859b
Gerrit-Change-Number: 469
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#9 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/469?usp=email )

Change subject: Use mingw compile definition also to unit tests
......................................................................

Use mingw compile definition also to unit tests

Currently we only apply the defines for windows APIs and Unicode to OpenVPN itself. We should rather treat the unit tests the same as our main binary to reduce potential differences.

Change-Id Ie5aa643ab6190262f7c8b9e614bedb398e85859b

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28019.html

---
M CMakeLists.txt

1 file changed, 8 insertions(+), 5 deletions(-)
CMakeLists.txt +8 -5
index bc46c27..6f370c3 100644
@@ -290,6 +290,13 @@
 
     endif ()
 
+    if (MINGW)
+        target_compile_definitions(${target} PRIVATE
+                -DWIN32_LEAN_AND_MEAN
+                -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA
+        )
+    endif()
+
     # optional dependencies
     target_link_libraries(${target} PUBLIC
         $<TARGET_NAME_IF_EXISTS:PkgConfig::liblz4>
@@ -545,11 +552,7 @@
 
 add_library_deps(openvpn)
 
-if (MINGW)
-    target_compile_options(openvpn PRIVATE
-        -DWIN32_LEAN_AND_MEAN
-        -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA
-        )
+if(MINGW)
     target_compile_options(openvpn PRIVATE -municode -UUNICODE)
     target_link_options(openvpn PRIVATE -municode)
 endif()

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie5aa643ab6190262f7c8b9e614bedb398e85859b
Gerrit-Change-Number: 469
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged